/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package singletonlogger;

import java.io.IOException;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Achilleas
 */
public class Admin {
    
    private String username;
    private SingletonLogger sl;
     
    public Admin(String username) throws IOException{
        sl = SingletonLogger.getInstance(); 
        adminSignedIn(username);
    
    }

    /**
     * @return the username
     */
    protected String getUsername() {
        return username;
    }

    /**
     * @param username the username to set
     */
    protected void setUsername(String username) {
        this.username = username;
    }
    
    public void adminSignedIn(String username){
        System.out.println("Admin " + username + " signed in at + " + new Date().toString());
         try {
        sl.bufferedWriter.write("Admin " + username + " signed in at + " + new Date().toString());
        sl.bufferedWriter.newLine();
        sl.bufferedWriter.flush();
         } catch (IOException ex) {
            Logger.getLogger(SingletonLogger.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    
}
